testsuite: don't write into installed locations
authorMatthias Clasen <mclasen@redhat.com>
Wed, 18 Oct 2017 01:33:59 +0000 (09:33 +0800)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 18 Oct 2017 15:30:20 +0000 (17:30 +0200)
Save the output of the render node tests in /tmp.

testsuite/gsk/test-render-nodes.c

index 0bae5f11465557a4e4c26ad80288fd827ee47e21..5a840539301d6777c33c9982b4734e0d35124feb 100644 (file)
@@ -444,12 +444,33 @@ file_replace_extension (const char *old_file,
   return g_string_free (file, FALSE);
 }
 
+static char *
+get_output_file (const char *file,
+                 const char *orig_ext,
+                 const char *new_ext)
+{
+  const char *dir;
+  char *result, *base;
+  char *name;
+
+  dir = g_get_tmp_dir ();
+  base = g_path_get_basename (file);
+  name = file_replace_extension (base, orig_ext, new_ext);
+
+  result = g_strconcat (dir, G_DIR_SEPARATOR_S, name, NULL);
+
+  g_free (base);
+  g_free (name);
+
+  return result;
+}
+
 static void
 save_image (cairo_surface_t *surface,
             const char      *test_name,
             const char      *extension)
 {
-  char *filename = file_replace_extension (test_name, ".node", extension);
+  char *filename = get_output_file (test_name, ".node", extension);
 
   g_test_message ("Storing test result image at %s", filename);
   g_assert (cairo_surface_write_to_png (surface, filename) == CAIRO_STATUS_SUCCESS);